package com.sxapp.config;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

@Component
public class ErrorPageConfig implements ErrorPageRegistrar{

	@Override
	public void registerErrorPages(ErrorPageRegistry registry) {
		 ErrorPage errorPages[] =  new ErrorPage[3];
		 errorPages[0] = new ErrorPage(HttpStatus.NOT_FOUND,"/error_404");
		 errorPages[1] = new ErrorPage(HttpStatus.BAD_REQUEST,"/error_400");
		 errorPages[2] = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR,"/error_500");
		 registry.addErrorPages(errorPages);
	} 
      
}
